home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / win / vb / sqlgrid.exe / WINMODS.BAS < prev   
Encoding:
BASIC Source File  |  1992-02-20  |  2.5 KB  |  94 lines

  1.  
  2. Function ElemInList (TheList As Control, Match$, Index%) As Integer
  3.   Cnt% = TheList.ListCount
  4.   i% = 0
  5.   Found = FALSE
  6.   Do While (i% < Cnt%) And (Found = FALSE)
  7.      If TheList.List(i%) = Match$ Then
  8.         Found = TRUE
  9.         Exit Do
  10.      End If
  11.      i% = i% + 1
  12.   Loop
  13.  
  14.   If Found Then
  15.       Index% = i%
  16.       ElemInList = TRUE
  17.   Else
  18.       Index% = -1
  19.       ElemInList = FALSE
  20.   End If
  21. End Function
  22.  
  23. Sub ResetLB (ThisControl As Control)
  24.   hLB% = ControlHwnd(ThisControl)
  25.   x% = SendMessage%(hLB%, LB_RESETCONTENT, 0, 0&)
  26. End Sub
  27.  
  28. Function DblAmpersand$ (S$)
  29.   T$ = S$
  30.   i% = InStr(T$, "&")
  31.   While i% <> 0
  32.      T$ = Left$(T$, i%) + "&" + Right$(T$, Len(T$) - i%)
  33.      i% = InStr(i% + 2, T$, "&")
  34.   Wend
  35.   DblAmpersand$ = T$
  36. End Function
  37.  
  38. Sub LBAddDirList (hLB%, Attr%, FileSpec As String)
  39.    rc& = SendMessage(hLB%, LB_DIR, Attr%, FileSpec)
  40. End Sub
  41.  
  42. Function LBSelectString% (hLB%, Start%, Prefix As String)
  43.    LBSelectString = SendMessage(hLB%, LB_SELECTSTRING, Start%, Prefix)
  44. End Function
  45.  
  46. Function LBSetTopIndex% (Ctrl As Control, Indx%)
  47.    Ctrl.ListIndex = Ctrl.ListCount - 1
  48.    Ctrl.ListIndex = Indx%
  49. End Function
  50.  
  51. Function LBSetCurSel% (hLB%, Indx%)
  52.    LBSetCurSel = SendMessage(hLB%, LB_SETCURSEL, Indx%, 0&)
  53. End Function
  54.  
  55. Sub LBResetContent (hLB%)
  56.   rc& = SendMessage(hLB%, LB_RESETCONTENT, 0, 0&)
  57. End Sub
  58.  
  59. Function LBSetTabStops (hLB%, Tabs() As Integer)
  60.    num% = UBound(Tabs) - LBound(Tabs)
  61.    LBSetTabStops = SendMessage(hLB%, LB_SETTABSTOPS, num%, Tabs(1))
  62. End Function
  63.  
  64. Function LBFindString% (hLB%, Start%, Prefix As String)
  65.    If Right$(Prefix, 1) <> Chr$(0) Then Prefix = Prefix + Chr$(0)
  66.    LBFindString = SendMessage(hLB%, LB_FINDSTRING, Start%, Prefix)
  67. End Function
  68.  
  69. Sub Make_Password_Control (EditControl As Control, PasswordMask As Integer)
  70.   ' PasswordMask is the ASC value of the char to use as the mask
  71.   Dim StyleFlags As Long
  72.   EditControl.SetFocus
  73.   hWnd = GetFocus()
  74.   StyleFlags = GetWindowLong(hWnd, GWL_STYLE)
  75.   StyleFlags = StyleFlags Or ES_PASSWORD
  76.   StyleFlags = SetWindowLong(hWnd, GWL_STYLE, StyleFlags)
  77.   StyleFlags = SendMessage(hWnd, EM_SETPASSWORDCHAR, PasswordMask, 0&)
  78. End Sub
  79.  
  80. Sub CBResetContent (hCB%)
  81.   rc& = SendMessage(hCB%, CB_RESETCONTENT, 0, 0&)
  82. End Sub
  83.  
  84. Sub CBSelectString (LB As Control, Prefix As String)
  85.    Found = FALSE
  86.    i% = 0
  87.    While (Not Found) And (i% < LB.ListCount)
  88.      If LB.List(i%) = Prefix Then Found = TRUE
  89.      i% = i% + 1
  90.    Wend
  91.    If Found Then LB.ListIndex = (i% - 1) Else LB.ListIndex = -1
  92. End Sub
  93.  
  94.